<%--
  Created by IntelliJ IDEA.
  User: yaozi
  Date: 2020/5/8
  Time: 22:37
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="IE=edge">
    <title>登录-学生端</title>
    <meta name="description" content="">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="robots" content="all,follow">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/bootstrap.min.css">
    <link rel="stylesheet" href="${pageContext.request.contextPath}/static/css/style.css" id="theme-stylesheet">
</head>
<body>
<div class="page login-page">
    <div class="container d-flex align-items-center">
        <div class="form-holder has-shadow">
            <div class="row">
                <!-- Logo & Information Panel-->
                <div class="col-lg-6">
                    <div class="info d-flex align-items-center">
                        <div class="content">
                            <div class="logo">
                                <h1>欢迎登录</h1>
                            </div>
                            <p>在线作业系统</p>
                        </div>
                    </div>
                </div>
                <!-- Form Panel    -->
                <div class="col-lg-6 bg-white">
                    <div class="form d-flex align-items-center">
                        <div class="content">
                            <form method="post" action="/student/stulogin" class="form-validate" id="loginFrom">
                                <div class="form-group">
                                    <input id="login-username" type="text" name="userName" required data-msg="请输入用户名"
                                           placeholder="用户名" value="admin"
                                           class="input-material">
                                </div>
                                <div class="form-group">
                                    <input id="login-password" type="password" name="passWord" required data-msg="请输入密码"
                                           placeholder="密码" class="input-material">
                                </div>
                                <div class="form-group">
                                    <div class="verify-wrap" id="verify-wrap"></div>
                                </div>
                                <button id="login-btn" type="submit" class="btn btn-default" disabled="disabled">登录
                                </button>
                            </form>
                            <br/>
                            <small>没有账号?</small><a href="/sregister.html" class="signup">&nbsp;注册</a>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
</body>
</html>
<!-- JavaScript files-->
<script src="${pageContext.request.contextPath}/static/js/jquery.min.js"></script>
<script src="${pageContext.request.contextPath}/static/js/bootstrap.min.js"></script>
<script src="${pageContext.request.contextPath}/static/plugins/vendor/jquery-validation/jquery.validate.min.js"></script>
<script src="${pageContext.request.contextPath}/static/js/jq-slideVerify.js"></script>
<!--表单验证-->
<!-- Main File-->
<!-- <script src="js/front.js"></script> -->
<script type="text/javascript">
    $(function () {
        var flagName = false;
        var flagPassWord = false;

        var SlideVerifyPlug = window.slideVerifyPlug;
        var slideVerify = new SlideVerifyPlug('#verify-wrap', {
            initText: '请按住滑块向右拖动！', //设置  初始的 显示文字
            sucessText: '验证通过！', //设置 验证通过 显示的文字
            getSuccessState: function (res) {
                fullValidata()
            }
        });
        var login_username = $('#login-username');
        var login_password = $('#login-password');
        var login_btn = $('#login-btn');
        flagName = login_username.val().length > 0;
        flagPassWord = login_password.val().length > 0;

        login_username.change(function () {
            flagName = login_username.val().length > 0;
            slideVerify.resetVerify();
            fullValidata()
        });
        login_password.change(function () {
            flagPassWord = login_password.val().length > 0;
            slideVerify.resetVerify();
            fullValidata()
        });


        function fullValidata() {
            if (flagName && flagPassWord && slideVerify.slideFinishState) {
                // 使注册按钮可用
                login_btn.removeClass("btn btn-default");
                login_btn.addClass("btn btn-primary");
                login_btn.removeAttr("disabled");
            } else {
                // 使得注册按钮不可用
                login_btn.removeClass("btn btn-primary");
                login_btn.addClass("btn btn-default");
                login_btn.attr("disabled", "disabled");
            }
        }
    })
</script>
